import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";

var _dec, _class;

import React, { PureComponent } from 'react';
import { Form, Input, Button, Row, Col } from 'antd';
import intl from 'utils/intl';
import { FORM_COL_4_LAYOUT, FORM_FIELD_CLASSNAME, SEARCH_COL_CLASSNAME, SEARCH_FORM_ITEM_LAYOUT, SEARCH_FORM_ROW_LAYOUT } from 'utils/constants';
var FormItem = Form.Item;
var QueryForm = (_dec = Form.create({
  fieldNameProp: null
}), _dec(_class = /*#__PURE__*/function (_PureComponent) {
  _inherits(QueryForm, _PureComponent);

  var _super = _createSuper(QueryForm);

  function QueryForm() {
    _classCallCheck(this, QueryForm);

    return _super.apply(this, arguments);
  }

  _createClass(QueryForm, [{
    key: "onClick",
    value: function onClick() {
      var _this$props = this.props,
          _this$props$handleFet = _this$props.handleFetchData,
          handleFetchData = _this$props$handleFet === void 0 ? function (e) {
        return e;
      } : _this$props$handleFet,
          _this$props$form$getF = _this$props.form.getFieldsValue,
          getFieldsValue = _this$props$form$getF === void 0 ? function (e) {
        return e;
      } : _this$props$form$getF;
      var data = getFieldsValue() || {};
      handleFetchData(_objectSpread({}, data));
    }
  }, {
    key: "onReset",
    value: function onReset() {
      var _this$props$form$rese = this.props.form.resetFields,
          resetFields = _this$props$form$rese === void 0 ? function (e) {
        return e;
      } : _this$props$form$rese;
      resetFields();
    }
  }, {
    key: "render",
    value: function render() {
      var _this$props2 = this.props,
          _this$props2$form$get = _this$props2.form.getFieldDecorator,
          getFieldDecorator = _this$props2$form$get === void 0 ? function (e) {
        return e;
      } : _this$props2$form$get,
          disabled = _this$props2.disabled;
      return /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(Row, SEARCH_FORM_ROW_LAYOUT, /*#__PURE__*/React.createElement(Col, FORM_COL_4_LAYOUT, /*#__PURE__*/React.createElement(FormItem, Object.assign({}, SEARCH_FORM_ITEM_LAYOUT, {
        label: intl.get("ciam.roleManagement.model.roleManagement.userLoginName").d('用户名')
      }), getFieldDecorator('userRealName')( /*#__PURE__*/React.createElement(Input, {
        className: FORM_FIELD_CLASSNAME
      })))), /*#__PURE__*/React.createElement(Col, Object.assign({}, FORM_COL_4_LAYOUT, {
        className: SEARCH_COL_CLASSNAME
      }), /*#__PURE__*/React.createElement(FormItem, null, /*#__PURE__*/React.createElement(Button, {
        onClick: this.onReset.bind(this)
      }, intl.get("cpaas.common.button.reset").d('重置')), /*#__PURE__*/React.createElement(Button, {
        type: "primary",
        htmlType: "submit",
        onClick: this.onClick.bind(this),
        disabled: disabled
      }, intl.get("cpaas.common.button.search").d('查询'))))));
    }
  }]);

  return QueryForm;
}(PureComponent)) || _class);
export { QueryForm as default };